<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Component 初识组件</title>
  <script src="../assets/js/vue.js"></script>
</head>

<body>
  <h1>Component-1</h1>
  <hr>
  <div id="app">
    <sunday></sunday>
    <sundaynei></sundaynei>
    <sundaynei1></sundaynei1>
  </div>
  <div id="app2">
    <sunday></sunday>
  </div>
  <script type="text/javascript">
    // 全局自定义组件 只能定义一个
    Vue.component('sunday', {
      template: `
        <div style="color: red;">我是全局的组件</div>
      `
    })
    var app = new Vue({
      el: '#app',
      components: {
        'sundaynei': {
          template: `
          <div style="color: green;">我是局部的组件</div>
          `
        },
        'sundaynei1': { 
        template: `
        <div style="color: green;">我是局部的组件1</div>
        ` 
        },
      }
    })
    var app2 = new Vue({
      el: '#app2'
    })
  </script>
</body>

</html>